package com.xuyiwei.xblog.core.base.constant.enums;

import com.xuyiwei.xblog.core.base.constant.ConstantStatusInterface;

import java.util.HashMap;
import java.util.Map;

/**
 * 是否是菜单的枚举
 *
 * @author fengshuonan
 * @date 2017年6月1日22:50:11
 */
public enum ExpenseState implements ConstantStatusInterface<Integer,String> {
    NULL(null, ""),
    SUBMITING(1, "待提交"),
    CHECKING(2, "待审核"),
    PASS(3, "审核通过"),
    UN_PASS(4, "未通过");


    private Integer key;
    private String desc;

    ExpenseState(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    @Override
    public Integer getKey() {
        return key;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    static Map<Integer, ExpenseState> map = new HashMap<>();

    static {
        for (ExpenseState bst : ExpenseState.values()) {
            map.put(bst.key, bst);
        }
    }

    public static ExpenseState convert(Integer key) {
        ExpenseState type = map.get(key);
        return (type != null) ? type : NULL;
    }
}
